<?php

use Illuminate\Routing\Router;
use Illuminate\Support\Facades\Route;
use Dcat\Admin\Admin;

use App\Admin\Controllers\WxShopGoodsController;

Admin::routes();

Route::post('api/skuImage', WxShopGoodsController::class . '@skuImage');

Route::group([
    'domain' => config('admin.route.domain'),
    'prefix' => config('admin.route.prefix'),
    'namespace' => config('admin.route.namespace'),
    'middleware' => config('admin.route.middleware'),
], function (Router $router) {

    $router->get('/', 'HomeController@index');

    $router->any('files/uploads', 'FileController@handle');

    // 配置
    $router->get('settings', 'WxSettingController@index');
    $router->post('settings', 'WxSettingController@index');
    // 微信小程序配置
    $router->post('settings/wx', 'WxSettingController@wx');
    // 上传设置
    $router->get('settings/oss', 'WxSettingController@oss');
    $router->post('settings/oss', 'WxSettingController@oss');
    // 附件
    $router->resource('attachment', 'WxAttachmentController');
    //回复反馈
//    $router->post('settings','WxSettingController@index');


    // 首页轮播图
    $router->resource('slideshow', 'WxSlideshowController');
    // 用户
    $router->resource('user', 'WxUserController');
    // 圈子
    $router->resource('circle', 'WxCircleController');
    // 板块
    $router->resource('plate', 'WxPlateController');
    // 文章
    $router->resource('posts/index', 'Posts\WxPostController');
    // 搜索记录
    $router->resource('search', 'WxSearchController');
    // 用户反馈
    $router->resource('feedback', 'WxFeedbackController');
    // 通知
    $router->resource('notice', 'WxNoticeController');
    // 认证
    $router->resource('authentication', 'WxAuthenticationController');
    // 条款
    $router->resource('clause', 'WxClauseController');
    // 评论
    $router->resource('commen', 'WxCommentController');
    // 用户资料
    $router->resource('usertemp', 'WxUserTempController');
    // 标签
    $router->resource('tags', 'Posts\WxTagController');
    // 订单
    $router->resource('order', 'WxOrderController');
    // 打赏
    $router->resource('exceptional', 'WxExceptionalController');
    // 用户金融
    $router->resource('financial', 'WxUserFinancialController');
    // 用户提现
    $router->resource('withdrawal', 'WxUserWithdrawalController');

    // SHOP
    // SHOP分类
    $router->resource('shop/classify', 'WxShopClassifyController');
    // SHOP商品
    $router->resource('shop/goods', 'WxShopGoodsController');
    // SHOP购物袋
    $router->resource('shop/cart', 'WxShopCartController');
    // SHOP订单
    $router->resource('shop/order', 'WxShopOrderController');
    // SHOP订单商品
    $router->resource('shop/orderGoods', 'WxShopOrderGoodsController');
    // SHOP订单售后
    $router->resource('shop/orderAfter', 'WxShopOrderAfterController');
    // SHOP收货地址
    $router->resource('shop/address', 'WxShopAddressController');
    // SHOP服务
    $router->resource('shop/service', 'WxShopServiceController');
    // SHOP通知
    $router->resource('shop/notice', 'WxShopNoticeController');
    //商品Fun
    Route::any('shop/save_goods/{id}', [\App\Admin\Controllers\WxShopGoodsController::class, 'save']);
    Route::post('shop/add_goods', [\App\Admin\Controllers\WxShopGoodsController::class, 'add']);


    // 更新页面
    $router->get('update/index', [\App\Admin\Controllers\UpdateController::class, 'index']);
    // 检查更新
    $router->get('update/check', [\App\Admin\Controllers\UpdateController::class, 'check']);

    // 下载
    $router->get('update/downloadFile', [\App\Admin\Controllers\UpdateController::class, 'downloadFile']);
    // 解压
    $router->get('update/unzip', [\App\Admin\Controllers\UpdateController::class, 'unzip']);
    // 更新sql
    $router->get('update/updateSql', [\App\Admin\Controllers\UpdateController::class, 'updateSql']);
    // 立即更新
    $router->get('update/nowupdate', [\App\Admin\Controllers\UpdateController::class, 'nowUpdate']);

    // PC端

    // 导航栏板块管理
    $router->resource('navigation/plate', 'WxNavigationPlateController');
    // 导航栏管理
    $router->resource('navigation', 'WxNavigationController');

});
